package persistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.swing.JOptionPane;

public class BDManager 
{
	private static final String driver = "org.postgresql.Driver";
	private static final String url = "jdbc:postgresql://localhost:5432/postgres";
	private static final String user = "postgres";
	private static final String pass = "1234";
	private Connection conexion;
	private static BDManager singleton;
	
	private BDManager()
	{
		try {
			Class.forName(driver);
			conexion = DriverManager.getConnection(url, user, pass);
		} 
		catch (Exception e) 
		{
			e.printStackTrace();
		}
	}
	
	public static BDManager getInstance()
	{
		if(singleton == null)
		{
			singleton = new BDManager();
		}
		return singleton;
		
	}
	
	Connection getConexion()
	{
		return this.conexion;
	}
	
	
}
